<template>
  <van-cell-group>
    <van-cell
      v-for="item in componentList"
      :key="item.name"
      :title="item.meta.title"
      is-link
      :to="'/demo/' + item.path"
    />
    <van-divider :style="{ color: '#333333', borderColor: '#9999999', padding: '0 16px' }">echart图表</van-divider>
    <van-cell v-for="item in chartList" :key="item.name" :title="item.title" is-link :to="'/echart/' + item.path" />
  </van-cell-group>
</template>
<script>
import { constantRoutes } from '@/router/index';
export default {
  data() {
    return {
      componentList: [],
      chartList: [{ name: '折线图', title: '折线图', path: 'line' }]
    };
  },
  created() {
    let arrList = [];
    constantRoutes.forEach(item => {
      if (item.name === 'Demo') {
        arrList = item.children;
      }
    });
    this.componentList = arrList.filter(item => {
      return item.name.indexOf('Chart') < 0;
    });

    this.chartList = [
      { name: '雷达图', title: '雷达图', path: 'radar' },
      { name: '漏斗图', title: '漏斗图', path: 'funnel' },
      { name: '仪表盘', title: '仪表盘', path: 'gauge' },
      { name: '折线图', title: '折线图', path: 'line' },
      { name: '柱状图', title: '柱状图', path: 'histogram' },
      { name: '饼图', title: '饼图', path: 'pie' },
      { name: '散点图', title: '散点图', path: 'scatter' },
      { name: 'K线图', title: 'K线图', path: 'candlestick' }
    ];
  },
  methods: {}
};
</script>
<style lang="less" scoped></style>
